
import * as types from '../mutation-types'
import io from '../../lib/io'
import storage from '../../lib/storage'

const state = {
    exam:{},
    examDetail:{},
    examBlock:[]
}

// getters
const getters = {
    // courseObj:state=>state.courseObj
}

// mutations
const mutations = {
    [types.GET_EXAM](state,data){
        state.exam=data
    },
    [types.GET_EXAM_BLOCK](state,data){
        state.examBlock=data
    },
    [types.GET_EXAM_DETAIL](state,data){
        state.examDetail=data
    },
}

// actions
const actions = {
    // 试卷模版列表
  async examModelList({ dispatch, commit }, opt) {
    let { data } = await io.post6(io.examModelList, opt)
    if (data.success) {
      commit(types.GET_EXAM,data.data)
    }
  },
    // 试卷模版详情
  async detailExamModel({ dispatch, commit }, opt) {
    let { data } = await io.post6(io.detailExamModel, opt)
    if (data.success) {
      commit(types.GET_EXAM_DETAIL,data.data)
    }
  },
//   试卷模块列表
  async examModelBlockList({ dispatch, commit }, opt) {
    let { data } = await io.post6(io.examModelBlockList, opt)
    if (data.success) {
      commit(types.GET_EXAM_BLOCK,data.data)
    }
  },
  
}

export default {
  state,
  getters,
  actions,
  mutations
}
